import type { TableColumn } from '@/components/core/dynamic-table';

export type TableListItem = API.TableListPageResultItem;
export type TableColumnItem = TableColumn<TableListItem>;
const operationParams = [
  {
    label: '未过期',
    value: 1,
  },
  {
    label: '已过期',
    value: 2,
  },
];
const operationParams2 = [
  {
    label: '送检',
    value: 1,
  },
  {
    label: '现场取样',
    value: 2,
  },
];
export const baseColumns: TableColumn[] = [
  {
    title: '关键字',
    align: 'left',
    dataIndex: 'keyword',
    hideInTable: true,
    formItemProps: {
      labelWidth: 55,
      componentProps: () => {
        return {
          placeholder: '可输入样品名、样品编号搜索',
          disabledLabelWidth: true,
        };
      },
    },
  },
  {
    title: '样品编号',
    align: 'left',
    dataIndex: 'userNum',
    hideInSearch: true,
  },
  {
    title: '样品名称',
    align: 'left',
    dataIndex: 'userLogin',
    hideInSearch: true,
  },

  {
    title: '样品状态',
    align: 'left',
    dataIndex: 'type',
    formItemProps: {
      component: 'Select',
      componentProps: {
        options: operationParams,
      },
    },
    customRender: ({ record }) =>
      operationParams.filter((item) => item.value == record.type)[0].label,
  },
  {
    title: '任务月份',
    align: 'left',
    dataIndex: 'userName',
    hideInSearch: true,
  },
  {
    title: '检测内容',
    align: 'left',
    dataIndex: 'action',
    hideInSearch: true,
  },
  {
    title: '领用数量/剩余数量',
    align: 'left',
    dataIndex: 'operationTime',
    hideInSearch: true,
  },
  {
    title: '取样方式',
    align: 'left',
    dataIndex: 'type2',
    formItemProps: {
      component: 'Select',
      componentProps: {
        options: operationParams2,
      },
    },
    customRender: ({ record }) =>
      operationParams2.filter((item) => item.value == record.type2)[0].label,
  },
  {
    title: '取样人',
    align: 'left',
    dataIndex: 'operationUser',
    hideInSearch: true,
  },
  {
    title: '接收人',
    align: 'left',
    dataIndex: 'operationUser2',
    hideInSearch: true,
  },
  {
    title: '保质期',
    align: 'left',
    dataIndex: 'operationUser3',
    hideInSearch: true,
  },
];

export const baseColumns2: TableColumn[] = [
  {
    title: '关键字',
    align: 'left',
    dataIndex: 'keyword',
    hideInTable: true,
    formItemProps: {
      labelWidth: 55,
      componentProps: () => {
        return {
          placeholder: '可输入样品名、样品编号搜索',
          disabledLabelWidth: true,
        };
      },
    },
  },
  {
    title: '样品编号',
    align: 'left',
    dataIndex: 'userNum',
    hideInSearch: true,
  },
  {
    title: '样品名称',
    align: 'left',
    dataIndex: 'userLogin',
    hideInSearch: true,
  },

  {
    title: '样品状态',
    align: 'left',
    dataIndex: 'type',
    formItemProps: {
      component: 'Select',
      componentProps: {
        options: operationParams,
      },
    },
    customRender: ({ record }) =>
      operationParams.filter((item) => item.value == record.type)[0].label,
  },
  {
    title: '任务月份',
    align: 'left',
    dataIndex: 'userName',
    hideInSearch: true,
  },
  {
    title: '检测内容',
    align: 'left',
    dataIndex: 'action',
    hideInSearch: true,
  },
  {
    title: '领用数量/剩余数量',
    align: 'left',
    dataIndex: 'operationTime',
    hideInSearch: true,
  },
  {
    title: '取样方式',
    align: 'left',
    dataIndex: 'type2',
    formItemProps: {
      component: 'Select',
      componentProps: {
        options: operationParams2,
      },
    },
    customRender: ({ record }) =>
      operationParams2.filter((item) => item.value == record.type2)[0].label,
  },
  {
    title: '取样人',
    align: 'left',
    dataIndex: 'operationUser',
    hideInSearch: true,
  },
  {
    title: '接收人',
    align: 'left',
    dataIndex: 'operationUser2',
    hideInSearch: true,
  },
  {
    title: '保质期',
    align: 'left',
    dataIndex: 'operationUser3',
    hideInSearch: true,
  },
];
